/*
 * HttpClient.h
 *
 *  Created on: 2017年3月31日
 *      Author: chuanjiang.zh
 */

#ifndef HTTPCLIENT_H_
#define HTTPCLIENT_H_

#include <iostream>
#include <time.h>
#include <functional>
#include "StringArray.h"


class HttpClientCallback
{
public:
	virtual ~HttpClientCallback() {}

	virtual void handleResponse(int code, const char* body, size_t size) = 0;

};


class HttpClient
{
public:
	virtual ~HttpClient() {}

	virtual bool get(const std::string& url, const StringMap& headers, HttpClientCallback* callback) =0;

	virtual bool post(const std::string& url, const StringMap& headers, const std::string& body, HttpClientCallback* callback) =0;

	virtual bool request(const std::string& url, const std::string& httpMethod, const StringMap& headers, const std::string& body,
		HttpClientCallback* callback) =0;

	virtual bool upload(const std::string& url, const StringMap& headers, const std::string& body, HttpClientCallback* callback) = 0;

	virtual void close() =0;

	virtual bool isOpen() =0;

};

#endif /* HTTPCLIENT_H_ */
